package com.kaifamiao.www.ioDemo.do0922;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.Set;

public class PropertiesDemo {
    public static void main(String[] args) {
        Properties prop = new Properties();

        InputStream in = PropertiesDemo.class.getClassLoader().getResourceAsStream("db.properties");
        try {
            prop.load(in);
        } catch (IOException e) {
            e.printStackTrace();
        }

    try {
        Class.forName(prop.getProperty("driver"));
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }


//        prop.put("url","jdbc:mysql://localhost:3306/kfm");
//        prop.put("driver","com.mysql.cj.jdbc.Driver");
//        prop.put("user","root");
//        prop.put("password","");
//
//        Set<Object> keySet = prop.keySet();
//        for (Object key : keySet){
//            System.out.println(key + ":" +prop.get(key));
//        }
    }
}
